﻿@using Model.Util.DTO;
@using Xproject.Util;
@{
    Layout = "~/Views/Shared/_JSlayout.cshtml";
    string Domain = CommonHelper.GetAppSettings("Domin");
}
@model AttributeModel
<link href="~/Content/categoryCss/site.css" rel="stylesheet" />
<script type="text/javascript">
    $(document).ready(function () {
        var optionsNew = {
            beforeSubmit: function () {
                //layer.open({ type: 2, time: 2 });
                layer.load(1, { shade: [0.1, '#000'], time: 2000 });
            },
            success: function (data) {
                if (data.Success == true) {
                    layer.alert('编辑成功', { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                } else {
                    layer.alert(data.Data, { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                }
            },
            error: function () {
                alert(JSON.stringify(data));
            },
            type: "post",
            clearForm: false,
            timeout: 100000
        };

        $("#AttributeForm").submit(function () {
            $("#AttributeForm").ajaxSubmit(optionsNew);// type="button"
            return false;
        });
    });


</script>
 
 
    <h1 class="rightH1">
        属性管理 &gt;&gt; 添加属性
        <div class="right">
            <a href="@(Domain)/Category/AttributeList?cateId= @ViewData["cateId"]" class="menuBT">
                <img src="../../content/images/goback.jpg" />返回列表
            </a>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
    </h1>
    <form class="form-horizontal m-t" id="AttributeForm" action="~/Category/AddAttribute?cateId=@ViewData["cateId"]" method="post">
        <div class="addTable">
            <table width="100%">
                <tr>
                    <td width="76px" align="right">
                        所属分类：
                    </td>
                    <td>
                        <input type="hidden" name="CateId" value="@ViewData["cateId"]" />
                        <input type="text" name="CategoryName" disabled="disabled" size="35" class="input" value="@ViewData["categoryName"]" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        属性名称：
                    </td>
                    <td>
                        <input class="form-control" name="AttributName" value="@(Model!=null?Model.AttributName:"")" required />
                      
                    </td>
                </tr>
                <tr id="attrGroupTr">
                    <td align="right">
                        属性分组：
                    </td>
                    <td>
                        <select data-val="true" data-val-number="字段 AttrGroupId 必须是一个数字。" data-val-range="请选择分类"    id="AttrGroupId" name="AttrGroupId">
                          
                            @foreach (SelectListItem info in ViewData["attributeGroupList"] as List<SelectListItem>)
        {
                    <option @if (info.Value == Model.AttrGroupId.ToString()) { <text> selected="selected" </text> }
                            value="@info.Value">
                        @info.Text
                    </option>
}
                        </select>                      
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        展示类型：
                    </td>
                    <td>
                        <p>
                            <label>
                                <input class="form-control" name="ShowType" value="0" type="checkbox" />
                                 文字
                            </label>
                            <label><input class="form-control" name="ShowType" value="1" type="checkbox" />图片</label>
                            
                            <br />
                        </p>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        筛选属性：
                    </td>
                    <td>
                        <p>
                            <label><input class="form-control" name="IsFilter" value="1" type="radio"  required/>
                             是</label>
                            <label><input class="form-control" name="IsFilter" value="0" type="radio"  required/>否</label>
                             
                            <br />
                        </p>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        排序：
                    </td>
                    <td>
                        <input class="form-control" name="DisplayOrder" value="@(Model!=null?Model.DisplayOrder:0)" required />                       
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        <button type="submit" href="" class="addBt" id="sumbitBut">
                            <img src="../../content/images/submit.jpg" />
                        </button>

                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>

        </form>